package jgl.vajra.kingkong.part.mine.viewModel;

import java.util.List;
import java.util.Map;

import jgl.vajra.kingkong.bean.AlipayAccountBean;
import jgl.vajra.kingkong.bean.BindAccountBean;
import jgl.vajra.kingkong.part.mine.contract.WithdrawalPageContract;
import jgl.vajra.kingkong.part.mine.model.WithdrawalPageModel;
import jgl.vajra.kingkong.widget.mvvm.factory.CreateModel;
import jgl.vajra.kingkong.widget.retrofithelper.rxsubscriber.ProgressObserver;
import jgl.vajra.kingkong.widget.utils.ToastUtils;

@CreateModel(WithdrawalPageModel.class)
public class WithdrawalPageViewModel extends WithdrawalPageContract.ViewModel{
    @Override
    public void getBindAccountData(Map<String, Object> map) {
        mModel.getBindAccountData(map).subscribe(new ProgressObserver<List<BindAccountBean>>(false,this) {
            @Override
            public void _onNext(List<BindAccountBean> data) {
                mView.returnBindAccountData(data);
            }
        });
    }

    @Override
    public void getAlipayAuthData(Map<String, Object> map) {
        mModel.getAlipayAuthData(map).subscribe(new ProgressObserver<String>(false,this) {
            @Override
            public void _onNext(String alipayAuth) {
                mView.returnAlipayAuthData(alipayAuth);
            }
        });
    }

    @Override
    public void getAlipayAccountData(Map<String, Object> map) {
        mModel.getAlipayAccountData(map).subscribe(new ProgressObserver<AlipayAccountBean>(false,this) {
            @Override
            public void _onNext(AlipayAccountBean data) {
                mView.returnAlipayAccountData(data);
            }
        });
    }

    @Override
    public void bindBankCardData(Map<String, Object> map) {
        mModel.bindBankCardData(map).subscribe(new ProgressObserver<String>(false,this) {
            @Override
            public void _onNext(String s) {
                ToastUtils.showShort(s);
                mView.returnBindBankCardData();
            }
        });
    }

    @Override
    public void incomeWithdrawData(Map<String, Object> map) {
        mModel.incomeWithdrawData(map).subscribe(new ProgressObserver<String>(true,this) {
            @Override
            public void _onNext(String s) {
                ToastUtils.showShort(s);
                mView.returnIncomeWithdrawData();
            }
        });
    }
}
